<template>
  <el-drawer v-model="addDrawer" size="45%" :show-close="false" @opened="openDrawer" @close="closeDrawer">
    <template #title>
      <h2><svg-icon icon-class="list"></svg-icon><span style="padding-left: 15px">{{typeName}}</span></h2>
      <el-button type="primary" @click="confirmClick" :disabled="drawerLoading" v-if="isShowSave">保存</el-button>
    </template>
    <template #default>
      <el-form :model="form" ref="addRef" :inline="true" :rules="formRules" label-width="140px" v-loading="drawerLoading">
        <el-row justify="space-between">
          <el-form-item label="省">
            <el-input v-model="form.province" clearable disabled></el-input>
          </el-form-item>
          <el-form-item label="市">
            <el-input v-model="form.city" clearable disabled></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="区/县">
            <el-input v-model="form.county" clearable disabled></el-input>
          </el-form-item>
          <el-form-item label="点编号" prop="id">
            <el-input v-model="form.id" placeholder="请输入点编号" clearable maxlength="17"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="目标区编号" prop="targetRegionId">
            <el-input v-model="form.targetRegionId" placeholder="请输入目标区编号" clearable maxlength="17"></el-input>
          </el-form-item>
          <el-form-item label="加速度值1" prop="ans">
            <el-input v-model="form.ans" placeholder="请输入加速度值1" clearable maxlength="8"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="卓越周期A1" prop="pans">
            <el-input v-model="form.pans" placeholder="请输入卓越周期A1" clearable maxlength="8"></el-input>
          </el-form-item>
          <el-form-item label="加速度值2" prop="aew">
            <el-input v-model="form.aew" placeholder="请输入加速度值2" clearable maxlength="8"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="周期A2" prop="paew">
            <el-input v-model="form.paew" placeholder="请输入周期A2" clearable maxlength="8"></el-input>
          </el-form-item>
          <el-form-item label="加速度值3" prop="aud">
            <el-input v-model="form.aud" placeholder="请输入加速度值3" clearable maxlength="8"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="周期A3" prop="paud">
            <el-input v-model="form.paud" placeholder="请输入周期A3" clearable maxlength="8"></el-input>
          </el-form-item>
          <el-form-item label="速度值1" prop="vns">
            <el-input v-model="form.vns" placeholder="请输入速度值1" clearable maxlength="8"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="周期V1" prop="pvns">
            <el-input v-model="form.pvns" placeholder="请输入周期V1" clearable maxlength="8"></el-input>
          </el-form-item>
          <el-form-item label="速度值2" prop="vew">
            <el-input v-model="form.vew" placeholder="请输入速度值2" clearable maxlength="8"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="周期V2" prop="pvew">
            <el-input v-model="form.pvew" placeholder="请输入周期V2" clearable maxlength="8"></el-input>
          </el-form-item>
          <el-form-item label="速度值3" prop="vud">
            <el-input v-model="form.vud" placeholder="请输入速度值3" clearable maxlength="8"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="周期V3" prop="pvud">
            <el-input v-model="form.pvud" placeholder="请输入周期V3" clearable maxlength="8"></el-input>
          </el-form-item>
          <el-form-item label="位移值1" prop="dns">
            <el-input v-model="form.dns" placeholder="请输入位移值1" clearable maxlength="8"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="周期D1" prop="pdns">
            <el-input v-model="form.pdns" placeholder="请输入周期D1" clearable maxlength="8"></el-input>
          </el-form-item>
          <el-form-item label="位移值2" prop="dew">
            <el-input v-model="form.dew" placeholder="请输入位移值2" clearable maxlength="8"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="周期D2" prop="pdew">
            <el-input v-model="form.pdew" placeholder="请输入周期D2" clearable maxlength="8"></el-input>
          </el-form-item>
          <el-form-item label="位移值3" prop="dud">
            <el-input v-model="form.dud" placeholder="请输入位移值3" clearable maxlength="8"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="周期D3" prop="pdud">
            <el-input v-model="form.pdud" placeholder="请输入周期D3" clearable maxlength="8"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="备注" prop="commentInfo" style="width:100%">
            <el-input v-model="form.commentInfo" placeholder="请输入备注" :autosize="{ minRows: 3, maxRows: 6 }"
              type="textarea" show-word-limit maxlength="2147483647" clearable></el-input>
          </el-form-item>
        </el-row>
      </el-form>
    </template>
  </el-drawer>
</template>
<script setup>
import useSpatialData from '@/hooks/useSpatialData'
import { eightDouble } from '@/utils/validate'
const { route, addDrawer, drawerLoading, form, typeName, openDrawer, closeDrawer, confirmClick, isShowSave } = useSpatialData()

const formRules = {
  id: [{ required: true, message: '请填写点编号！', trigger: 'blur' }],
  targetRegionId: [{ required: true, message: '请填写目标区编号！', trigger: 'blur' }],
  ans: [eightDouble],
  pans: [eightDouble],
  aew: [eightDouble],
  paew: [eightDouble],
  aud: [eightDouble],
  paud: [eightDouble],
  vns: [eightDouble],
  pvns: [eightDouble],
  vew: [eightDouble],
  pvew: [eightDouble],
  vud: [eightDouble],
  pvud: [eightDouble],
  dns: [eightDouble],
  pdns: [eightDouble],
  dew: [eightDouble],
  pdew: [eightDouble],
  dud: [eightDouble],
  pdud: [eightDouble]
}
</script>
<style scoped></style>